// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   Items.java

import java.io.PrintStream;
import java.util.*;

public class Items
{
    public static class item
    {

        int val;
        int weight;

        public item(int val, int weight)
        {
            this.val = val;
            this.weight = weight;
            List elem = new ArrayList(2);
            elem.add(Integer.valueOf(val));
            elem.add(Integer.valueOf(weight));
        }
    }


    public Items()
    {
        items1 = new ArrayList();
        items2 = new ArrayList();
    }

    public void show()
    {
        System.out.print("items1: ");
        item item;
        for(Iterator iterator = items1.iterator(); iterator.hasNext(); System.out.print((new StringBuilder()).append("[").append(item.val).append(",").append(item.weight).append("] ").toString()))
            item = (item)iterator.next();

        System.out.println();
        System.out.print("items2: ");
        item item;
        for(Iterator iterator1 = items2.iterator(); iterator1.hasNext(); System.out.print((new StringBuilder()).append("[").append(item.val).append(",").append(item.weight).append("] ").toString()))
            item = (item)iterator1.next();

        System.out.println();
    }

    private List dealContains()
    {
        List temp = new ArrayList();
        List ret = new ArrayList();
        item item;
        for(Iterator iterator = items1.iterator(); iterator.hasNext(); temp.add(Integer.valueOf(item.val)))
            item = (item)iterator.next();

        item item;
        for(Iterator iterator1 = items2.iterator(); iterator1.hasNext(); temp.add(Integer.valueOf(item.val)))
            item = (item)iterator1.next();

        Iterator iterator2 = temp.iterator();
        do
        {
            if(!iterator2.hasNext())
                break;
            Integer integer = (Integer)iterator2.next();
            if(!ret.contains(integer))
                ret.add(integer);
        } while(true);
        for(int i = 0; i < ret.size() - 1; i++)
        {
            for(int j = 0; j < ret.size() - 1 - i; j++)
                if(((Integer)ret.get(j)).intValue() > ((Integer)ret.get(j + 1)).intValue())
                {
                    int k = ((Integer)ret.get(j)).intValue();
                    ret.set(j, ret.get(j + 1));
                    ret.set(j + 1, Integer.valueOf(k));
                }

        }

        return ret;
    }

    public void combineVal()
    {
        List retItems = new ArrayList();
        List arr = dealContains();
        for(int i = 0; i < arr.size(); i++)
        {
            int allweight = 0;
            for(int j = 0; j < items1.size(); j++)
                if(((Integer)arr.get(i)).intValue() == ((item)items1.get(j)).val)
                    allweight += ((item)items1.get(j)).weight;

            for(int j = 0; j < items2.size(); j++)
                if(((Integer)arr.get(i)).intValue() == ((item)items2.get(j)).val)
                    allweight += ((item)items2.get(j)).weight;

            retItems.add(new item(((Integer)arr.get(i)).intValue(), allweight));
        }

        System.out.println("\u5408\u5E76\u540E");
        for(int i = 0; i < retItems.size(); i++)
            System.out.print((new StringBuilder()).append("[").append(((item)retItems.get(i)).val).append(",").append(((item)retItems.get(i)).weight).append("] ").toString());

        System.out.println();
    }

    List items1;
    List items2;
}
